home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Bitwise Operator, ~, Help
- Date: 05 Jan 1996 04:26:07 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Jan4212607@qcd.lanl.gov>
- References: <4bkhg7$4fd@berry.elite.net> <4bsf7r$pn0@spanky.pls.ov.com>
- <4bt51o$7nc@news2.ios.com> <4cch26$9vv@caip.rutgers.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: halasz@caip.rutgers.edu's message of 2 Jan 1996 19:02:14 -0500
-
- --text follows this line--
- In article <4cch26$9vv@caip.rutgers.edu> halasz@caip.rutgers.edu writes:
- In article <4bt51o$7nc@news2.ios.com>, aldo@tribeca.ios.com (Aldo
- Di Domenico) writes
- > Almost...... but how does the compiler knows how many bits to operate
- > on? Will a compiler that uses 5 bytes (or whatever) for an int return a
- > different value than one which uses 4 (doesn't sound too likely), or does
- > it all depend on the number of leading zero's that you use?
-
- It depends on the implicit type of the constant. This type is alwais
- one that one can declare a variable in (that is, the length of the
- constant written in decimal, octonarie, or sedenarie digits is
- irrelevant). If no letter is uzed, decimal constants are signd and
- binarie are not, and the length is of 'int'. Otherwize the letters
- "L" and "U" set its length and signedness.
-
- Almost. To avoid later confusion, it should probably be mentioned that
- a long (or, where appropriate, unsigned long) is chosen if required to
- preserve the value. Similarly, decimal need not be signed: an unsigned
- will be chosen (even in preference to a longer type) if it will do. If
- unsigned long does not suffice, it is an error.
-
- In the givven example, if 'int' is 32 bits long, then both 0177 and ~0177
- are 32 bits long.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-